formidableforms limit only 2 submissions per user

72

add_action('frm_display_form_action', 'check_entry_count', 8, 3);
function check_entry_count($params, $fields, $form){
  global $user_ID;
  remove_filter('frm_continue_to_new', '__return_false', 50);
  if($form->id == 5 and !is_admin()){ //replace 5 with the ID of your form
    $count = FrmEntry::getRecordCount("form_id=". $form->id ." AND user_id=".$user_ID); 
    if($count >= 2){ //change 2 to your entry limit
      echo 'This form is closed';
      add_filter('frm_continue_to_new', '__return_false', 50);
    }
  }
}

Comments

Submit
0 Comments